/*
 ============================================================================
 Name		: ResponseUserScores.cpp
 Author	  : 
 Version	 : 1.0
 Copyright   :
 Description : CResponseUserScores implementation
 ============================================================================
 */

#include "ResponseUserScores.h"
#include "ResponseDefinses.h"
#include "ProjectsDefines.h"

#include "ResponseMagazineItemData.h"

CResponseUserScores::CResponseUserScores()
{
    // No implementation required
}

CResponseUserScores::~CResponseUserScores()
{

}

CResponseUserScores* CResponseUserScores::NewLC()
{
    CResponseUserScores* self = new ( ELeave ) CResponseUserScores( );
    CleanupStack::PushL( self );
    self->ConstructL( );
    return self;
}

CResponseUserScores* CResponseUserScores::NewL()
{
    CResponseUserScores* self = CResponseUserScores::NewLC( );
    CleanupStack::Pop( ); // self;
    return self;
}

void CResponseUserScores::ConstructL()
{

}

void CResponseUserScores::LoadValidResponseFromXmlNode(CElement* elementResponse)
{
    _ASSERT_LOG( elementResponse != NULL );

    if( !elementResponse )
    {
        return;
    }

    CElement* elementResult = elementResponse->GetElement( kResponseResultNode );

    _ASSERT_LOG( elementResult != NULL );
    if( !elementResult )
    {
        return;
    }
    _LIT( kResponseCostScoreNode, "cost_score" );

    CElement* element = elementResult->GetElement( kResponseCostScoreNode );
    if( element )
    {
        _cost_score = element->GetElementTextAsInt( );
    }
    _LIT( kResponseRankScoreNode, "rank_score" );
    element = elementResult->GetElement( kResponseRankScoreNode );
    if( element )
    {
        _rank_score = element->GetElementTextAsInt( );
    }
}
